{include file="common/mainHead"/}
 <script type="text/javascript" src="__STATIC__/js/jquery.2.1.1.min.js"></script>
     <script type="text/javascript" src="__STATIC__/js/webuploader.js"></script>
    <script type="text/javascript" src="__STATIC__/js/upload.js"></script>
    <link rel="stylesheet" type="text/css" href="__STATIC__/js/webuploader.css" />
  <link rel="stylesheet" type="text/css" href="__STATIC__/js/style.css" />
      <script type="text/javascript" src="__STATIC__/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/ueditor/ueditor.all.min.js"></script>

    <script>
          window.UEDITOR_HOME_URL='__STATIC__/ueditor/';
         window.onload=function (){
             window.UEDITOR_CONFIG.initialFrameWidth="null"; 
            window.UEDITOR_CONFIG.initialFrameHeight=400;
             UE.getEditor('myEditor');
         }
</script>

   <script>
   	var load="__URL__/upload";
   	
       
         
</script>

<div class="admin-main fadeInUp animated" ng-app="hd" ng-controller="ctrl">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>添加文章</legend>
    </fieldset>
    <form class="layui-form layui-form-pane" action="{:url('add')}" method="post" id="form1">
    	 <!--<div class="layui-form-item">
            <label class="layui-form-label">请选择模型</label>
            <div class="layui-input-3">
                <select name="c_id" lay-verify="required" lay-filter="moduleid" id="moduleid">
                    {volist name="cate" id="vo"}
                        <option value="{$vo.id}">{$vo.title}</option>
                    {/volist}
                </select>
            </div>
        </div>-->
        
         <div class="layui-form-item">
            <label class="layui-form-label">所属栏目</label>
            <div class="layui-input-3">
                <select name="c_id" id="parentid">
                   
                    {$categorys}
                </select>
            </div>
        </div>
       
        <div class="layui-form-item">
            <label class="layui-form-label">商品标题</label>
            <div class="layui-input-4">
                <input type="text" name="title" ng-model="field.title" lay-verify="required" placeholder="标题" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="site-demo-upload">
                <img id="cltThumb" src="__ADMIN__/images/tong.png">
                <div class="site-demo-upbar">
                    <input type="file" name="image" lay-type="images" class="layui-upload-file" id="image">
                     <input type="hidden" name="img"   id="img">
                </div>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">商品简介</label>
            <div class="layui-input-block">
                <textarea placeholder="{:lang('pleaseEnter')}SEO描述" name="description" class="layui-textarea"></textarea>
            </div>
        </div>
        
         <div class="layui-form-item">
            <label class="layui-form-label">商品原价</label>
            <div class="layui-input-4">
                <input type="text" name="price1" ng-model="field.price1" lay-verify="required" placeholder="商品原价" class="layui-input">
            </div>
        </div>
         <div class="layui-form-item">
            <label class="layui-form-label">商品现价</label>
            <div class="layui-input-4">
                <input type="text" name="price2" ng-model="field.price2" lay-verify="required" placeholder="商品现价" class="layui-input">
            </div>
        </div>
        
         <div class="layui-form-item">
            <label class="layui-form-label">商品积分</label>
            <div class="layui-input-4">
                <input type="text" name="jifen" ng-model="field.jifen" lay-verify="required" placeholder="商品积分" class="layui-input">
            </div>
        </div>
   
        
        
         <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">{:lang('content')}</label>
            <div class="layui-input-block">
                <textarea  name="content"  id="myEditor"></textarea>
            </div>
        </div>
        
        
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">相册</label>
            <div class="layui-input-block">
               
<ul id="photos" class="pic-list unstyled"></ul>
								
			<div id="uploader" >
                <div class="queueList">
                    <div id="dndArea" class="placeholder">
                        <div id="filePicker"></div>
                        <p >或将照片拖到这里，单次最多可选300张</p>
                    </div>
                </div>
                <div class="statusBar" style="display:none;">
                    <div class="progress">
                        <span class="text">0%</span>
                        <span class="percentage"></span>
                    </div><div class="info"></div>
                    <div class="btns">
                        <div id="filePicker2"></div><div class="uploadBtn">开始上传</div>
                    </div>
                </div>
           </div>	
               
               
               
            </div>
        </div>
        
        
        
            <div class="layui-form-item">
            <label class="layui-form-label">是否置顶</label>
            <div class="layui-input-1">
                <input type="checkbox" name="iszd" value="1" lay-skin="switch" title="多栏目设置">
            </div>
            <div class="layui-form-mid layui-word-aux">打开后，文章置顶</div>
        </div>   
        
        
        
        
        
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button>
                <a href="{:url('index')}" class="layui-btn layui-btn-primary">{:lang('back')}</a>
            </div>
        </div>
       
    </form>
</div>
{include file="common/mainFoot"/}
<script src="__STATIC__/js/angular.min.js"></script>
  <script type="text/javascript" src="__STATIC__/js/jquery.js"></script>
    <script type="text/javascript" src="__STATIC__/js/webuploader.js"></script>
    <script type="text/javascript" src="__STATIC__/js/upload.js"></script>
    <link rel="stylesheet" type="text/css" href="__STATIC__/js/webuploader.css" />
  <link rel="stylesheet" type="text/css" href="__STATIC__/js/style.css" />
  
 
<script>
	
	  var m = angular.module('hd',[]);
    m.controller('ctrl',['$scope',function($scope) {
        $scope.field = '{$info}'!='null'?{$info}:{id:'',title:'',content:''};
        
        layui.use(['form', 'layer','layedit','upload'], function () {
            var form = layui.form(), layer = layui.layer,layedit = layui.layedit,upload = layui.upload;
        upload({
            url: '{:url("upFiles/upload")}',
            title: '缩略图',
            ext: 'jpg|png|gif', //那么，就只会支持这三种格式的上传。注意是用|分割。
            success: function(res, input){
                cltThumb.src = "__PUBLIC__"+res.url;
                image = res.url;
            }
        });



            layedit.set({
                uploadImage: {
                    url: '{:url("UpFiles/editUpload")}',
                    type: 'post'
                }
            });

            var layeCon = layedit.build('content');
            form.on('submit(submit)', function (data) {
            


     $('#img').val(image);
     $('#form1').submit();


            })
        });
    }]);
	
	
	
	
</script>